package com.china.school;

import com.china.school.pojo.DatabaseInfo;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.*;

//<context:property-placeholder location="jdbc.properties"/>

//<context:component-scan base-package="com.china.school.pojo,com.china.school.dao"/>
@Configuration //<beans/>
@PropertySource({"classpath:jdbc.properties"}) //<context:property-placeholder location=""/>
@ComponentScan({"com.china.school.pojo","com.china.school.dao"}) //<context:component-scan base-package="xx"/>
@Import(DatabaseInfo.class) //<Import/>
public class ComponentTest {


    public static void main(String[] args) {
//        ApplicationContext ctx = new ClassPathXmlApplicationContext("ComponentTest.xml");
        ApplicationContext ctx = new AnnotationConfigApplicationContext(ComponentTest.class) ;
        System.out.println(ctx.getBean("user"));
        System.out.println(ctx.getBean("databaseInfo"));

    }
}
